package com.example.forum.dao;

import com.example.forum.model.Article;
import com.example.forum.model.ArticleReply;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ArticleReplyMapper {
    int insert(ArticleReply row);

    int insertSelective(ArticleReply row);

    ArticleReply selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ArticleReply row);

    int updateByPrimaryKey(ArticleReply row);

    /**
     * 查询文章对应的所有回复帖子
     * @param articleId 文章id
     * @return 所有回复帖子
     */
    List<ArticleReply> selectRepliesByArticleId(@Param("articleId") Long articleId);

    /**
     * 查询当前回复下的所有回复
     * @param articleId 帖子id
     * @param replyId 一楼回复id
     * @return 二楼回复
     */
    List<ArticleReply> selectRepliesByReplyId(@Param("articleId")Long articleId,@Param("replyId") Long replyId);
}